﻿@model IEnumerable<INTREPWEB.Models.Embarque>
@{
    ViewBag.Title = "Embarques";

    if (IsAjax)
    {
        Layout = null;
    <script type="text/javascript" src="@Url.Content("~/Scripts/intrep-embarque.js")" ></script>
    }
    else
    {
    <text>
    @section Scripts{
    <script type="text/javascript" src="@Url.Content("~/Scripts/intrep-embarque.js")" ></script>
    }
    </text>
    }
}
@Html.Partial("_ToolBar")
@if (ViewBag.Vazio == null)
{
<table>
    <tr>
        <th>
            Id
        </th>
        <th>
            Data de Início
        </th>
        <th>
            Data de Fim
        </th>
        <th>
            Navio
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Ajax.ActionLink(item.Id, "Editar", new { id = item.Id }, new AjaxOptions { OnBegin = "criaModal('criarembarque')", UpdateTargetId = "criarembarque", OnSuccess = "$.modalPopup('criarembarque')" })
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DataInicio)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DataFim)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Navio.Nome)
            </td>
            <td>
                @Ajax.ActionLink("x", "Deletar", new { id = item.Id }, new AjaxOptions { OnBegin = "criaModal('deletarembarque')", UpdateTargetId = "deletarembarque", OnSuccess = "$.modalPopup('deletarembarque')" })
            </td>
        </tr>
    }
</table>
}
else
{
    @Html.Partial("_SemItens")
}